home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Magazine 28 Bonus
/
CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin
/
data
/
artmain.dir
/
00094_Script_QTVR Mac Scripts
< prev
next >
Wrap
Text File
|
1996-06-05
|
29KB
|
736 lines
-- ⌐ 1992-1995 Apple Computer, Inc. All rights reserved.
--=============================================================================
-- Routines for initializing and cleaning up the Director movie.
-------------------------------------------------------------------------------
--=============================================================================
-- StartMovie
--
-- Runs at movie start time. Initializes key globals, opens the external code
-- library, registers the QuickTime VR components, and sets up the XCMD Callback
-- Factory.
-------------------------------------------------------------------------------
on InitQTVRMac
global gPanoMovieID, gNavMovieID, gPathName, gLastTimeRollover, gPanoFrame
put empty into gPanoMovieID
put empty into gNavMovieID
put empty into gPathName
put false into gLastTimeRollover
put empty into gPanoFrame
-- Need to open up the external xlib so that we don't have the
-- XCMD floating-point bug problem when we save.
-- This would be commented out just before we turn this into a projector.
openxlib (the pathName & "ARTMAINA:QuickTime VR XCMDs")
-- Register the QuickTime VR component
-- This would turn into RegisterComponent (":", empty) when the components are
-- embedded in the projector.
RegisterComponent (the pathname & "ARTMAINA:QuickTime VR Components", empty)
-- Need to set up the XCMD Callback Factory so that we can execute callbacks
-- to Lingo handlers from PanoMovie
global gQTVRCallBackFactory
put CallBackTracer(mNew) into gQTVRCallBackFactory
SetCallBack PanoMovie,gQTVRCallBackFactory
end InitQTVR
--=============================================================================
-- StopMovie
--
-- Runs at movie stop time. Closes any open pano or nav movies. Disposes
-- of the XCMD Callback Factory and closes the external code library.
-------------------------------------------------------------------------------
on disposeQTVRMac
-- Close any open panoramic or object movies
ClosePanoMovieMac
CloseNavMovieMac
-- Close the external XCMD library
-- This would be commented out just before we turn this into a projector.
closexlib (the pathname & "ARTMAINA:QuickTime VR XCMDs")
-- Dispose of the XCMD Callback Factory
global gQTVRCallBackFactory
if objectP(gQTVRCallBackFactory) then gQTVRCallBackFactory (mDispose)
end disposeQTVRMac
--=============================================================================
-- Routines for managing navigable movies
-------------------------------------------------------------------------------
--=============================================================================
-- OpenNavMovieMac:
-- pFilename is the full file path of the file
-- pSpriteNum is the sprite associated with the direct Nav Movie
-- pShowOnOpen is a boolean for showing the movie on screen immediately
--
-- Opens the file pFileName as a nav movie at the top left corner of sprite
-- pSpriteNum. Shows it on the screen as dictated by pShowOnOpen.
-------------------------------------------------------------------------------
on OpenNavMovieMac pFilename, pSpriteNum, pShowOnOpen
global gNavMovieID
-- The use of a single global gNavMovieID constrains these routines
-- to only allow one pano movie to be open at a time.
-- Close any other open nav movie.
CloseNavMovieMac
-- Load in the movie. Assume the underlying sprite is the correct size.
put NavMovie ("openMovie", "Direct", pFilename ,¼
the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum, ¼
"ShowPoster", "Invisible") into gNavMovieID
if gNavMovieID contains "error" then
put gNavMovieID
put empty into gNavMovieID
beep
exit
end if
if pShowOnOpen then
-- Show the poster frame of the nav movie on screen
NavMovie "Direct", gNavMovieID, "update"
end if
end OpenNavMovie
--=============================================================================
-- ShowNavMovie
--
-- Updates the nav movie display on screen.
-------------------------------------------------------------------------------
on ShowNavMovieMac
global gNavMovieID
if gNavMovieID <> empty then
NavMovie "Direct", gNavMovieID, "update"
end if
end ShowNavMovieMac
--=============================================================================
-- ZoomNavMovie:
-- pStartZoomRect specifies the start rect as a string rect
-- [pSkipFirstFrame] is "true" if the first zoom frame should not be shown
-- [pClipRect] is the screen string rect to which the zoom should be clipped
--
-- Zooms the nav movie out from the start rect specified, possibly skipping
-- the first frame and clipping to a given rect.
-------------------------------------------------------------------------------
on ZoomNavMovieMac pStartZoomRect, pSkipFirstFrame, pClipRect
global gNavMovieID
if gNavMovieID <> empty then
put "ZoomOutMovie" && quote & pStartZoomRect & quote into tCommand
if not voidP(pSkipFirstFrame) then
put tCommand & "," & pSkipFirstFrame into tCommand
end if
if not voidP(pClipRect) then
put tCommand & "," & quote & pClipRect & quote into tCommand
end if
NavMovie "Direct", gNavMovieID, tCommand
-- Send an idle so that if MoviesTask() is called, we don't get a
-- spurious update
NavMovie "Direct", gNavMovieID, "idle"
end if
end ZoomNavMovieMac
--=============================================================================
-- SetNavMovieViewMac:
-- pHPan is the horizontal pan angle
-- pVPan is the vertical pan angle
--
-- Sets the nav movie view to the specified pan angles.
-------------------------------------------------------------------------------
on SetNavMovieViewMac pHPan, pVPan
global gNavMovieID
if gNavMovieID <> empty then
NavMovie "Direct", gNavMovieID, "set", "hPanAngle", pHPan
NavMovie "Direct", gNavMovieID, "set", "vPanAngle", pVPan
end if
end SetNavMovieViewMac
--=============================================================================
-- CloseNavMovieMac
--
-- Disposes an open nav movie. This does not remove the image from
-- the screen.
-------------------------------------------------------------------------------
on CloseNavMovieMac
global gNavMovieID
if gNavMovieID <> empty then
NavMovie "Direct", gNavMovieID, "dispose"
put empty into gNavMovieID
end if
end CloseNavMovieMac
--=============================================================================
-- NavFrameScript
-- pSpriteNum is the sprite which lies under the nav movie
--
-- When run frequently, provides cursor feedback over the nav movie
-- and handles mouse down and keyboard actions.
-------------------------------------------------------------------------------
on NavFrameScriptMac pSpriteNum
global gNavMovieID
if gNavMovieID <> empty and RunningInForeground() = "true" then
if rollover (pSpriteNum) then
NavMovie "Direct", gNavMovieID, "mouseOver"
-- Set the cursor twice because Director tries to be smart and
-- doesn't change the cursor if your current cursor command
-- is the same as the last one. It doesn't realize of course,
-- that QTVR has changed the cursor in between.
-- KNOWN BUG: It appears that the cursor command is ignored if the mouse
-- is not over the stage, so if you move out of the movie window
-- fast enough and off the stage, the cursor will remain unchanged.
cursor 200
cursor -1
else
NavMovie "Direct", gNavMovieID, "idle"
end if
end if
end NavFrameScriptMac
--=============================================================================
-- Routines for managing panoramic movies
-------------------------------------------------------------------------------
--=============================================================================
-- OpenPanoM